package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.social.facebook.api.Facebook;
import org.springframework.social.facebook.api.PagedList;
import org.springframework.social.facebook.api.Post;
import org.springframework.social.facebook.api.impl.FacebookTemplate;

@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
    

    /*
     * SPRING BOOTSTRAP MAIN
     */
    public static void main(String[] args) {
    	while(true) {
    		
    		try {
    			Application.showFeeds();
				Thread.sleep(10000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
    	}
//        SpringApplication.run(Application.class, args);
    }
    
    public static void showFeeds() {
    	String token = "CAAJ70rQCo4UBAF2GCZCY9zyJRZBt8Al1cWHCaY3Wut6t2M4ys5iOeJqewdXrcbA4urp0tuZC9NDIM1R6p77HbqZB5sZCuY3TTTwfTfMnMZBqHJeMvY62WMg6NMFOpKgiQZBW0u6T9dzfROw9eLYxEIiZAEKKXLZA5JZBSSxI5wOehfP4EbmmPrFCs2z2cKVbSjn3dlsQZB8CSjSwLEbJaUgD4V0";
    	Facebook facebook=new FacebookTemplate(token);
        PagedList<Post> homeFeed = facebook.feedOperations().getHomeFeed();
    
        System.out.println("MURAL-PORTO MAGNET-**********(****************************");
        homeFeed =  facebook.feedOperations().getFeed();//1379413749015737

        for (Post post : homeFeed) {
        	
        	System.out.println("post="+ post.getMessage());
		}
        	
        System.out.println("MURAL-FABIO-**********************************************");
        token = "CAAJ70rQCo4UBAJJW6hQvuu1pM3C3Er7yphG2nuzlS2EBIKYZCvHg1Cb77F08FoY8ZBWZCcQVVKZBu3fKeRnPjG0byWeDyanLNZASWpWBOhR7S8ClwBMi4rR5OaPjip3ZAePYThLJLwT5HkJ1koUYyZCFDbCLZCNv0F0BZClZAnOQMAQGoAZBLBHcBFsxoxzBlgxg7cT4efu6rZCbdCixtN4158ET";

        facebook=new FacebookTemplate(token);
        homeFeed = facebook.feedOperations().getHomeFeed();


        homeFeed =  facebook.feedOperations().getFeed(); //728851463852354
        for (Post post : homeFeed) {
        	
        	System.out.println("post="+ post.getMessage());
		}



    }

}